<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<div class="t_bar"><span class="color_red">*</span>投资完成情况</div>
<table cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;" id="invest1">
     <tr >
		<td align="center"  width="20%">支出科目</td>
		<td class="TblHead" align="center" width="20%" >投资金额<br/>（万元）</td>
		<td class="TblHead" align="center" width="20%" >投资地点<br/>（XX市/XX）</td>
		<td class="TblHead" align="center" width="20%" >用途说明</td>
		<td class="TblHead" align="center" width="20%" >备注</td>
	</tr>
	<tr>
	<td>1、设备费</td>
	<td><input type="text" name="investments/total_invest1"  id="total_invest_1" 
					class="gray"  disabled label="设备费投资金额"  onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right; " 
					value="<x:out select="$xmlData/data/investments/total_invest1" />" 
	/></td>
	<td><input type="text" name="investments/address1"  id="address1" maxlength="50" class="required" label="设备费投资地点"  value="<x:out select="$xmlData/data/investments/address1" />" /></td>
	<td><input type="text" name="investments/application1"  id="application1" maxlength="50" class="required" label="设备费用途说明"  value="<x:out select="$xmlData/data/investments/application1" />" /></td>
	<td><input type="text" name="investments/remark1"  id="remark1" maxlength="50" class="required" label="设备费备注"  value="<x:out select="$xmlData/data/investments/remark1" />" /></td>
	</tr>
	<tr>
	<td>（1）购置设备费</td>
	<td><input type="text" name="investments/total_invest2"  id="total_invest_2" 
					class="required"  label="购置设备费投资金额"  onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right; " 
					value="<x:out select="$xmlData/data/investments/total_invest2" />" 
					onchange="countFundAuto('total_invest_','2,3,4','1');setTotalVal();" 
	/></td>
	<td><input type="text" name="investments/address2"  id="address2" maxlength="50" class="required" label="购置设备费投资地点"  value="<x:out select="$xmlData/data/investments/address2" />" /></td>
	<td><input type="text" name="investments/application2"  id="application2" maxlength="50" class="required" label="购置设备费用途说明"  value="<x:out select="$xmlData/data/investments/application2" />" /></td>
	<td><input type="text" name="investments/remark2"  id="remark2" maxlength="50" class="required" label="购置设备费备注"  value="<x:out select="$xmlData/data/investments/remark2" />" /></td>
	</tr>
	<tr>
	<td>（2）自制设备费</td>
	<td><input type="text" name="investments/total_invest3"  id="total_invest_3" 
					class="required"  label="自制设备费投资金额"  onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right; " 
					value="<x:out select="$xmlData/data/investments/total_invest3" />" 
					onchange="countFundAuto('total_invest_','2,3,4','1');setTotalVal();" 
	/></td>
	<td><input type="text" name="investments/address3"  id="address3" maxlength="50" class="required" label="自制设备费投资地点"  value="<x:out select="$xmlData/data/investments/address3" />" /></td>
	<td><input type="text" name="investments/application3"  id="application3" maxlength="50" class="required" label="自制设备费用途说明"  value="<x:out select="$xmlData/data/investments/application3" />" /></td>
	<td><input type="text" name="investments/remark3"  id="remark3" maxlength="50" class="required" label="自制设备费备注"  value="<x:out select="$xmlData/data/investments/remark3" />" /></td>
	</tr>
	<tr>
	<td>（3）设备改造与租赁</td>
	<td><input type="text" name="investments/total_invest4"  id="total_invest_4" 
					class="required"  label="设备改造与租赁投资金额"  onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right; " 
					value="<x:out select="$xmlData/data/investments/total_invest4" />" 
					onchange="countFundAuto('total_invest_','2,3,4','1');setTotalVal();" 
	/></td>
	<td><input type="text" name="investments/address4"  id="address4" maxlength="50" class="required" label="设备改造与租赁投资地点"  value="<x:out select="$xmlData/data/investments/address4" />" /></td>
	<td><input type="text" name="investments/application4"  id="application4" maxlength="50" class="required" label="设备改造与租赁用途说明"  value="<x:out select="$xmlData/data/investments/application4" />" /></td>
	<td><input type="text" name="investments/remark4"  id="remark4" maxlength="50" class="required" label="设备改造与租赁备注"  value="<x:out select="$xmlData/data/investments/remark4" />" /></td>
	</tr>
	<tr>
	<td>2、基本建设费</td>
	<td><input type="text" name="investments/total_invest5"  id="total_invest_5" 
					class="gray"  disabled label="基本建设费投资金额"  onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right; " 
					value="<x:out select="$xmlData/data/investments/total_invest5" />" 
	/></td>
	<td><input type="text" name="investments/address5"  id="address5" maxlength="50" class="required" label="基本建设费投资地点"  value="<x:out select="$xmlData/data/investments/address5" />" /></td>
	<td><input type="text" name="investments/application5"  id="application5" maxlength="50" class="required" label="基本建设费用途说明"  value="<x:out select="$xmlData/data/investments/application5" />" /></td>
	<td><input type="text" name="investments/remark5"  id="remark5" maxlength="50" class="required" label="基本建设费备注"  value="<x:out select="$xmlData/data/investments/remark5" />" /></td>
	</tr>
	<tr>
	<td>（1）购置土地</td>
	<td><input type="text" name="investments/total_invest6"  id="total_invest_6" 
					class="required"  label="购置土地投资金额"  onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right; " 
					value="<x:out select="$xmlData/data/investments/total_invest6" />" 
					onchange="countFundAuto('total_invest_','6,7,8','5');setTotalVal();" 
	/></td>
	<td><input type="text" name="investments/address6"  id="address6" maxlength="50" class="required" label="购置土地投资地点"  value="<x:out select="$xmlData/data/investments/address6" />" /></td>
	<td><input type="text" name="investments/application6"  id="application6" maxlength="50" class="required" label="购置土地用途说明"  value="<x:out select="$xmlData/data/investments/application6" />" /></td>
	<td><input type="text" name="investments/remark6"  id="remark6" maxlength="50" class="required" label="购置土地备注"  value="<x:out select="$xmlData/data/investments/remark6" />" /></td>
	</tr>
	<tr>
	<td>（2）建造厂房</td>
	<td><input type="text" name="investments/total_invest7"  id="total_invest_7" 
					class="required"  label="建造厂房投资金额"  onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right; " 
					value="<x:out select="$xmlData/data/investments/total_invest7" />" 
					onchange="countFundAuto('total_invest_','6,7,8','5');setTotalVal();" 
	/></td>
	<td><input type="text" name="investments/address7"  id="address7" maxlength="50" class="required" label="建造厂房投资地点"  value="<x:out select="$xmlData/data/investments/address7" />" /></td>
	<td><input type="text" name="investments/application7"  id="application7" maxlength="50" class="required" label="建造厂房用途说明"  value="<x:out select="$xmlData/data/investments/application7" />" /></td>
	<td><input type="text" name="investments/remark7"  id="remark7" maxlength="50" class="required" label="建造厂房备注"  value="<x:out select="$xmlData/data/investments/remark7" />" /></td>
	</tr>
	<tr>
	<td>（3）其他费用</td>
	<td><input type="text" name="investments/total_invest8"  id="total_invest_8" 
					class="required"   label="其他费用投资金额"  onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right; " 
					value="<x:out select="$xmlData/data/investments/total_invest8" />" 
					onchange="countFundAuto('total_invest_','6,7,8','5');setTotalVal();" 
	/></td>
	<td><input type="text" name="investments/address8"  id="address8" maxlength="50" class="required" label="其他费用投资地点"  value="<x:out select="$xmlData/data/investments/address8" />" /></td>
	<td><input type="text" name="investments/application8"  id="application8"  maxlength="50" class="required" label="其他费用用途说明"  value="<x:out select="$xmlData/data/investments/application8" />" /></td>
	<td><input type="text" name="investments/remark8"  id="remark8" maxlength="50" class="required" label="其他费用备注"  value="<x:out select="$xmlData/data/investments/remark8" />" /></td>
	</tr>
	<tr>
	<td>3、其他（20字内说明，可添加下级科目）</td>
	<td><input type="text" name="investments/total_invest9"  id="total_invest9" maxlength="50" class="required" label="其他投资金额"  value="<x:out select="$xmlData/data/investments/total_invest9" />" /></td>
	<td><input type="text" name="investments/address9"  id="address9" maxlength="50" class="required" label="其他投资地点"  value="<x:out select="$xmlData/data/investments/address9" />" /></td>
	<td><input type="text" name="investments/application9"  id="application9" maxlength="50" class="required" label="其他用途说明"  value="<x:out select="$xmlData/data/investments/application9" />" /></td>
	<td><input type="text" name="investments/remark9"  id="remark9" maxlength="50" class="required" label="其他备注"  value="<x:out select="$xmlData/data/investments/remark9" />" /></td>
	</tr>
	<tr>
	<td align="center">合计</td>
	<td><input type="text" name="investments/total_invest10"  id="total_invest10" onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right; "  class="gray" disabled label="投资金额合计"  value="<x:out select="$xmlData/data/investments/total_invest10" />" /></td>
	<td align="center">/</td>
	<td align="center">/</td>
	<td align="center">/</td>
	</tr>

</table>
<div class="t_bar">其他支出科目信息</div>
<table  id="tblInvestments" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
			<thead >
					<tr style="border:1px solid #B7D1E6">
						<th class="TblHead" align="center"  width="5%">选择</th>
						<th class="TblHead" align="center"  width="5%">序号</th>
						<th class="TblHead" align="center"  width="18%">支出科目</th> 
						<th class="TblHead" align="center"  width="18%">投资金额<br/>（万元）</th> 
						<th class="TblHead" align="center"  width="18%">投资地点<br/>（XX市/XX）</th> 
						<th class="TblHead" align="center"  width="18%">用途说明</th> 
						<th class="TblHead" align="center"  width="18%">备注</th> 
					</tr>
			</thead>
			<tbody id="tab">
					<tr style="display:none">
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name=selInvestments >
						</td>
						<td align="center">&nbsp;
							<span name="investments|investment[0]@seq_no" >[index]</span> 
						</td>
						<td align="center">
							<input type="text" name="investments|investment[0]|invest_prj"  class=" input_text required" maxlength="50" style="width:80%" label="支出科目"/>
						</td>
						<td align="center">
							<input type="text" name="investments|investment[0]|invest_money"  label="投资金额" maxlength="50" onchange="setTotalVal();" onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right;width:80%;" class="input_text required" />
						</td> 
						<td align="center">
							<input type="text" name="investments|investment[0]|invest_address" label="投资地点"  maxlength="50"  style="width:80%" class="input_text required" />
						</td> 
						<td align="center">
							<input type="text" name="investments|investment[0]|application"  label="用途说明"  style="width:80%" class=" input_text required" />
						</td> 
						<td align="center">
							<input type="text" name="investments|investment[0]|remark"  label="备注"  style="width:80%" class=" input_text required" />
						</td> 
					</tr>
					
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/investments/investment" var="investment">
					
					<c:choose>
						<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
						<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
					</c:choose>
					<tr align="center">
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name="selInvestments" >
						</td>
						<td align="center">&nbsp;
							<span name="investments/investment[${flag}${index}]@seq_no" ><x:out select="$investment/@seq_no"/></span> 
						</td>
						<td>
							<input type="text" name="investments/investment[${flag}${index}]/invest_prj"   style="width:80%"   class=" input_text required" value="<x:out select="$investment/invest_prj"/>" label="支出科目" maxlength="50"/>
						</td>
						<td >
							<input type="text" name="investments/investment[${flag}${index}]/invest_money"  onchange="setTotalVal();" style="text-align:right;width:80%" onfocus="InitInput.setNumber(this,7,4,2)" class=" input_text required" value="<x:out select="$investment/invest_money"/>" label="投资金额" maxlength="50"/>
						</td> 
						<td >
							<input type="text" name="investments/investment[${flag}${index}]/invest_address" style="width:80%"  class=" input_text required" value="<x:out select="$investment/invest_address"/>" label="投资地点" maxlength="50"/>
						</td> 
						<td >
							<input type="text" name="investments/investment[${flag}${index}]/application"     label="用途说明" style="width:80%"  class=" input_text required" value="<x:out select="$investment/application" />"/>
						</td> 
						<td >
							<input type="text" name="investments/investment[${flag}${index}]/remark"  label="备注"  style="width:80%"  class=" input_text required" value="<x:out select="$investment/remark" />"/>
						</td> 
					</tr>
					<c:set value="${index+1}" var="index" scope="page"/>
					</x:forEach>
				</tbody>
					</table>
					<table width="98%" align="center">
					<tr ><td>
					<input class="button" name="cmdAddbefore" type=button value="添加" onclick="addNewRow('tblInvestments');try{top.resizeFrame();}catch(e){};">
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblInvestments','selInvestments')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblInvestments','selInvestments')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblInvestments','支出科目信息');">
					</td></tr>
	</table>
	
<script type="text/javascript">
function setTotalVal(){
	var other_total = "";
	$("#tblInvestments").find("input[name$='invest_money']").each(function(){
		other_total = formatVal2(parseFloat(other_total) + parseFloat($(this).val()));
	});	
	var total_invest_1 = $("#total_invest_1").val();
	var total_invest_5 = $("#total_invest_5").val();
	$("#total_invest10").val(formatVal2(parseFloat(other_total) + parseFloat(total_invest_1) + parseFloat(total_invest_5)));
}

</script>
<%-- <table  id="tblInvestments" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
			<thead >
					<tr style="border:1px solid #B7D1E6">
						<th class="TblHead" align="center"  width="5%">选择</th>
						<th class="TblHead" align="center"  width="5%">序号</th>
						<th class="TblHead" align="center"  width="15%">投资项目</th> 
				        <th class="TblHead" align="center"  width="15%">投入类别</th> 
						<th class="TblHead" align="center"  width="15%">投资金额<br/>（万元）</th> 
						<th class="TblHead" align="center"  width="15%">投资地点<br/>（XX市/XX）</th> 
						<th class="TblHead" align="center"  width="15%">用途说明</th> 
						<th class="TblHead" align="center"  width="15%">备注</th> 
					</tr>
			</thead>
			<tbody id="tab">
					<tr style="display:none">
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name=selInvestments >
						</td>
						<td align="center">&nbsp;
							<span name="investments|investment[0]@seq_no" >[index]</span> 
						</td>
						<td align="center">
							<input type="text" name="investments|investment[0]|invest_prj"  class=" input_text required" maxlength="50" style="width:80%" label="投资项目"/>
						</td>
						<td align="center">
							<!-- <input type="text" name="investments|investment[0]|invest_type"  maxlength="10"  style="width:80%" class=" input_text required" label="投入类别"/> -->
						    <cpt:select id="invest_type[index]" key="invest_type1" name="invest_type" onChange="initControlValue(this.id);setInvest(this.id,this.value);" value="" style="width:98%;"></cpt:select>
				            <input type="text" id="invest_other[index]"  name="investments|investment[0]|invest_other" maxlength="20" class="required" label="投入类别-->其他" value="" style="display:none;width:89%;"/>
				            <input type="hidden" name="investments|investment[0]|invest_type_value" class="required" label="资助方式" value=""/>
				            <input type="hidden" name="investments|investment[0]|invest_type_name" value=""/>
						</td> 
						<td align="center">
							<input type="text" name="investments|investment[0]|invest_money"  label="投资金额" maxlength="50" onchange="setMoney();" onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right;width:80%;" class="input_text required" />
						</td> 
						<td align="center">
							<input type="text" name="investments|investment[0]|invest_address" label="投资地点"  maxlength="50"  style="width:80%" class="input_text required" />
						</td> 
						<td align="center">
							<input type="text" name="investments|investment[0]|application"  label="用途说明"  style="width:80%" class=" input_text required" />
						</td> 
						<td align="center">
							<input type="text" name="investments|investment[0]|remark"  label="备注"  style="width:80%" class=" input_text required" />
						</td> 
					</tr>
					
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/investments/investment" var="investment">
					
					<c:choose>
						<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
						<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
					</c:choose>
					<tr align="center">
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name="selInvestments" >
						</td>
						<td align="center">&nbsp;
							<span name="investments/investment[${flag}${index}]@seq_no" ><x:out select="$investment/@seq_no"/></span> 
						</td>
						<td>
							<input type="text" name="investments/investment[${flag}${index}]/invest_prj"   style="width:80%"   class=" input_text required" value="<x:out select="$investment/invest_prj"/>" label="投资项目" maxlength="50"/>
						</td>
						<td >
							<input type="text" name="investments/investment[${flag}${index}]/invest_type" style="width:80%"  class=" input_text required" value="<x:out select="$investment/knowledge"/>" label="投入类别" maxlength="10"/>
						    <c:set var="invest_type_value"><x:out select="$investment/invest_type_value" /></c:set>
							<cpt:select id="invest_type${index}" key="invest_type1"  name="invest_type" onChange="initControlValue(this.id);setInvest(this.id,this.value);" value="${invest_type_value }" style="width:98%"></cpt:select>
							<input type="text" id="invest_other${index}"  name="investments/investment[${flag}${index}]/invest_other" class="required" label="投入类别-->其他" maxlength="20" value="<x:out select="$investment/invest_other" />" style="display:none;width:89%"/>
				            <input type="hidden" name="investments/investment[${flag}${index}]/invest_type_value" class="required" label="投入类别" value="<x:out select="$investment/invest_type_value" />"/>
				            <input type="hidden" name="investments/investment[${flag}${index}]/invest_type_name" value="<x:out select="$investment/invest_type_name" />"/>
						</td> 
						<td >
							<input type="text" name="investments/investment[${flag}${index}]/invest_money" onchange="setMoney();" style="text-align:right;width:80%" onfocus="InitInput.setNumber(this,7,4,2)" class=" input_text required" value="<x:out select="$investment/invest_money"/>" label="投资金额" maxlength="50"/>
						</td> 
						<td >
							<input type="text" name="investments/investment[${flag}${index}]/invest_address" style="width:80%"  class=" input_text required" value="<x:out select="$investment/invest_address"/>" label="投资地点" maxlength="50"/>
						</td> 
						<td >
							<input type="text" name="investments/investment[${flag}${index}]/application"     label="用途说明" style="width:80%"  class=" input_text required" value="<x:out select="$investment/application" />"/>
						</td> 
						<td >
							<input type="text" name="investments/investment[${flag}${index}]/remark"  label="备注"  style="width:80%"  class=" input_text required" value="<x:out select="$investment/remark" />"/>
						</td> 
					</tr>
					<c:set value="${index+1}" var="index" scope="page"/>
					</x:forEach>
				</tbody>
					</table>
					<table cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" >
					<tr>
					<td colspan="2" width="10%" align="center">合计</td>
					<td width="15%" align="center">\</td>
					<td width="15%" align="center">\</td>
					<td width="15%" align="center"><input type="text" name="investment/total_money" id="total_money" disabled class="input_text gray" style="width:80%;text-align: right" label="投资金额合计" value="<x:out select="$xmlData/data/investment/total_money" />"/></td>
					<td width="15%" align="center">\</td>
					<td width="15%" align="center">\</td>
					<td width="15%" align="center">\</td>
					</tr>
					</table>
					<table width="98%" align="center">
					<tr ><td>
					<input class="button" name="cmdAddbefore" type=button value="添加" onclick="addNewRow('tblInvestments');setMoney();try{top.resizeFrame();}catch(e){};">
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblInvestments','selInvestments')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblInvestments','selInvestments')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblInvestments','投资完成情况');setMoney();">
					</td></tr>
	</table> 
	<script type="text/javascript">
	$(function(){
		$("#tblInvestments").find("select").each(function(){
			var name=$(this).attr("name");
			var value = $(this).parents("tr").find("input[name$='"+name+"_value']").val();
			id = $(this).attr("id");
			setInvest(id,value);
		});
		setMoney();
	});
	
	function setInvest(id,value){
		var otherId = id.replace("invest_type","invest_other");
		if(value == 3){
			$("#"+otherId).css("display","");
			$("#"+otherId).addClass("required");
		} else{
			$("#"+otherId).css("display","none");
			$("#"+otherId).removeClass("required");
			$("#"+otherId).val("");
		}
	}
	
	function setMoney(){
		var money = 0;
		$("#tblInvestments").find("input[name$='invest_money']").each(function(){
			if($.isNumeric($(this).val())){
				money = parseFloat(money) + parseFloat($(this).val());
			}
		});
		$("#total_money").val(formatNumberAuto(money+"", 9, 4, 2));
		$("#investment").val(formatNumberAuto(money+"", 9, 4, 2));
	}
	</script>--%>